<template>
	<view>
		<view>
			<text>{{ random }}</text>
		</view>
	</view>
</template>


<script>
	var self = null;
	export default {
		data() {
			return {
				random: 0
			}
		},
		onLoad: function () {
			self = this;
			this.timer = setInterval(function () {
				self.random = Math.random(); //修改对象
			}, 1000);
		},
		onUnload: function () {
			if (this.timer) {
				clearInterval(this.timer); //销毁定时器
			}
		}
	}
</script>

<style>

</style>
